<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8" />
	<title>千郡医疗</title>
	<meta name="keywords" content="" />
	<meta name="description" content="" />
	<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" th:href="@{/weixin/css/style.css}" />
	<link rel="stylesheet" th:href="@{/weixin/css/weui.min.css}" />
	<script type="text/javascript" th:src="@{/weixin/js/adaptive.js}"></script>
	<script type="text/javascript" th:src="@{/weixin/js/fastclick.min.js}"></script>
	<script type="text/javascript" th:src="@{/weixin/js/zepto.min.js}"></script>
	<script type="text/javascript" th:src="@{/weixin/js/picker-citys.js}"></script>
	<script type="text/javascript" th:src="@{/weixin/js/weui.min.js}"></script>
	<style type="text/css">
	 body{font-size: initial !important;}
	</style>
</head>
<body>
	<section class="register">
		<form id="form">
		<ul class="list">
			<li><input type="password" name="oldpwd" id="oldpwd" class="txt" placeholder="请输入旧密码" /></li>
			<li><input type="password" name="newpwd" id="newpwd" class="txt" placeholder="请输入新密码" /></li>
			<li><input type="password" id="newpwd2" class="txt" placeholder="请输入确认密码" /></li>
		</ul>
		</form>
		<p class="subBox mt50"><a href="javascript:;" id="submit" class="comBtn">确定</a></p>
	</section>
</body>
<script type="text/javascript">
$(function(){
	$("#submit").click(function() {
		if (!validate())
			return;

		var l = weui.loading("正在提交")
		$.ajax({
			cache : true,
			type : "POST",
			url : "/qianjun/weixin/customer/pwdmodify",
			data : $('#form').serialize(),
			error : function(request) {
				l.hide();
				weui.alert("修改失败");
			},
			success : function(data) {
				l.hide();
				data.success ? weui.toast("修改成功") : weui.alert(data.msg);
			}
		});
	});
})


function validate() {
	if($("#oldpwd").val() == '' || $("#newpwd").val() == ''){
		weui.alert("请输入旧密码和新密码");
		return false;
	}
	
	if ($("#newpwd").val() != $("#newpwd2").val()) {
		weui.alert("两次密码不一致");
		return false;
	}

	return true;
}


</script>
</html>